import { Request } from "@/utils/request";

const url = {
  getPaperStarList: "/user/paper/starlist",
  starPaper: "/user/paper/star",
  getAuthorStarList: "/user/author/starlist",
  starAuthor: "/user/author/star",
  getJournalStarList: "/user/journal/starlist",
  starJournal: "/user/journal/star",
  getOrgStarList: "/user/org/starlist",
  starOrg: "/user/org/star",
  getMyPaperList: "/user/paper/mylist",
  getMyNotification: "/user/notify/list",
  checkMyNotification: "/user/notify/check",
  checkAll: "/user/notify/checkall",
  getUserInfo: "/user/info/detail",
  changeUserName: "/user/info/changeName",
  sendVercode : "/user/info/accVercode",
  changeUserAcc: "/user/info/changeAcc",
  changeUserPwd: "/user/info/changePwd",
  uploadPortrait:"/user/info/uploadPor",
};

export const user = {
  // 获取论文收藏列表
  getPaperStarList: function (params: any) {
    return Request.axiosInstance({
      url: url.getPaperStarList,
      method: "get",
      params: params,
    });
  },
  // 收藏论文
  starPaper: function (params: any) {
    return Request.axiosInstance({
      url: url.starPaper,
      method: "post",
      data: params,
    });
  },
  // 获取学者收藏列表
  getAuthorStarList: function (params: any) {
    return Request.axiosInstance({
      url: url.getAuthorStarList,
      method: "get",
      params: params,
    });
  },
  //收藏学者
  starAuthor: function (params: any) {
    return Request.axiosInstance({
      url: url.starAuthor,
      method: "post",
      data: params,
    });
  },
  // 获取期刊/会议收藏列表
  getJournalStarList: function (params: any) {
    return Request.axiosInstance({
      url: url.getJournalStarList,
      method: "get",
      params: params,
    });
  },
  //收藏期刊/会议
  starJournal: function (params: any) {
    return Request.axiosInstance({
      url: url.starJournal,
      method: "post",
      data: params,
    });
  },
  // 获取机构收藏列表
  getOrgStarList: function (params: any) {
    return Request.axiosInstance({
      url: url.getOrgStarList,
      method: "get",
      params: params,
    });
  },
  //收藏机构
  starOrg: function (params: any) {
    return Request.axiosInstance({
      url: url.starOrg,
      method: "post",
      data: params,
    });
  },
  // 获取用户自己的学术成果
  getMyPaperList: function (params: any) {
    return Request.axiosInstance({
      url: url.getMyPaperList,
      method: "get",
      params: params,
    });
  },
  // 获取当前用户消息列表
  getMyNotification: function (params: any) {
    return Request.axiosInstance({
      url: url.getMyNotification,
      method: "get",
      params: params,
    });
  },
  // 用户消息已读
  checkMyNotification: function (params: any) {
    return Request.axiosInstance({
      url: url.checkMyNotification,
      method: "post",
      data: params,
    });
  },
  // 用户消息全部已读
  checkAll: function (params: any) {
    return Request.axiosInstance({
      url: url.checkAll,
      method: "post",
      data: params,
    });
  },
  // 获取用户信息
  getUserInfo: function (params: any) {
    return Request.axiosInstance({
      url: url.getUserInfo,
      method: "get",
      params: params,
    });
  },
  // 修改用户昵称
  changeUserName: function (params: any) {
    return Request.axiosInstance({
      url: url.changeUserName,
      method: "post",
      data: params,
    });
  },
  // 发送新邮箱验证码
  sendVercode: function (params: any) {
    return Request.axiosInstance({
      url: url.sendVercode,
      method: "get",
      params: params,
    });
  },
  // 修改邮箱
  changeUserAcc: function (params: any) {
    return Request.axiosInstance({
      url: url.changeUserAcc,
      method: "post",
      data: params,
    });
  },
  // 修改密码
  changeUserPwd: function (params: any) {
    return Request.axiosInstance({
      url: url.changeUserPwd,
      method: "post",
      data: params,
    });
  },
  //上传新头像
  uploadPortrait: function(params:any){
    return Request.axiosInstance({
      url:url.uploadPortrait,
      method:"post",
      data:params,
    });
  }
};
